package main

import "fmt"

type Teacher struct {
	Name string
	Age int
}
//创建一个结构体对象
func main()  {
	//var teacher Teacher
	//teacher := new(Teacher)
	teacher := Teacher{}
	teacher.Name = "John"
	teacher.Age =  10
	fmt.Printf("before modify teacher is %+v\n",teacher)
	
	modifyTeacher(teacher)
	fmt.Printf("after modify by object teacher is %+v\n",teacher)

	modifyTeacher2(&teacher)
	fmt.Printf("after modify by pointer teacher is %+v\n",teacher)
}
func modifyTeacher(teacher Teacher) {
	teacher.Age = 11
	fmt.Printf("object internal teacher is %+v\n",teacher)
}
func modifyTeacher2(teacher *Teacher) {
	teacher.Age = 11
	fmt.Printf("pointer internal teacher is %+v\n",teacher)
}